//
//  VisitorTableViewController.m
//  OC--新浪微博
//
//  Created by Apple on 15/11/9.
//  Copyright © 2015年 Apple. All rights reserved.
//

#import "VisitorTableViewController.h"
#import "OAuthViewController.h"
@interface VisitorTableViewController ()
//用户登录标记
@property (nonatomic, assign) BOOL userLogin;

@end

@implementation VisitorTableViewController
//用户登录标记

 //BOOL  userLogin = [UserAccountViewModel shardViewModel].isExpired;
 /// 访客视图
- (void)loadView {
    self.userLogin = [UserAccountViewModel shardViewModel].userlogin;
    self.userLogin ? [super loadView] : [self setUpVisitorView];

}
- (void)viewDidLoad {
    [super viewDidLoad];
    
}
//MARK: - 创建访客视图方法
- (void)setUpVisitorView {
    self.visitorView = [VisitorView new];
    self.view = self.visitorView;
    [self.visitorView.registerButton addTarget:self action:@selector(visitorViewDidRegister) forControlEvents:UIControlEventTouchUpInside];
    [self.visitorView.LoginButton addTarget:self action:@selector(visitorViewDidLogin) forControlEvents:UIControlEventTouchUpInside];
   //设置导航按钮
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"注册" style:UIBarButtonItemStylePlain target:self action:@selector(visitorViewDidRegister)];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"登录" style:UIBarButtonItemStylePlain target:self action:@selector(visitorViewDidLogin)];
}
//MARK: - 监听方法
- (void)visitorViewDidRegister {
    NSLog(@"注册");
}
- (void)visitorViewDidLogin {
    OAuthViewController *vc = [OAuthViewController new];
    UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc];
    [self presentViewController:nav animated:YES completion:nil];

}
@end
